package com.cskaoyan.controller.admin;

import com.cskaoyan.bean.entity.Comment;
import com.cskaoyan.bean.vo.BasePageData;
import com.cskaoyan.bean.vo.BaseParam;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther Wenjian_Yang
 * @Date 2021/10/19
 */
@RequestMapping("admin/comment")
@RestController
public class CommentController {

    @Autowired
    CommentService commentService;

    //http://localhost:8083/admin/comment/list
    // ?page=1&limit=20&sort=add_time&order=desc
    //评论信息界面
    @RequestMapping("list")
    public BaseRespVo list(Integer userId, Integer valueId, BaseParam param){
        BasePageData query = commentService.query(userId, valueId, param);
        return BaseRespVo.ok(query);
    }

    //删除商品评论
    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody Comment comment){
        commentService.delete(comment);
        return BaseRespVo.ok();
    }



}
